<#include "/common/layout.html"> 
<@layout title="123">
<script type="text/javascript" src="/js/easyui/easyui_grid.js"></script>
<script type="text/javascript">
var datagrid;
var model_name = "/payRecord";
var model_title="支付记录";
	$(function() {
		
		$("#shop_id").combotree({    
		    url: '/shop/combotree/',  
		    multiple:true,
	    	editable:false,
		    width:200
		});
		
		$('#community_id').combobox({    
	    	url: '/community/combobox',   
		    valueField:'name',    
		    textField:'name',
		    editable:true,
		    width:150
	    });
		
		datagrid=$('#form_datagrid').datagrid({
		 	url:model_name+'/grid',
		 	columns:[[    
		        {field:'id',title:'编号',width:80},
		        {field:'payNo',title:'支付串号',width:100},
		        {field:'order_no',title:'支付订单编号',width:160,
		        	formatter:function(value,row,index){
		        		return "<a href='#' onclick='payRecordView("+row.id+")'>"+(value==null?"":value)+"</a>";
			        }
		        },
		        {field:'serialNo',title:'微信支付流水号',width:150},
		        {field:'userName',title:'支付用户',width:70},
		        {field:'userPhone',title:'用户手机号',width:100},
		        {field:'status',title:'状态',width:70,
		        	formatter:function(value,row,index){
			      		if(row.status=='SUCCESS'){
			      			return "<font color='red'>支付成功</font>";
			      		}else if(row.status=='FAIL'){
			      			return "支付失败";
			      		}else {
			      			return "未支付";
			      		}
					}
		        },
		        {field:'shopName',title:'供应商',width:130},
		        {field:'community_name',title:'社区服务点',width:100},
		        {field:'receipt_name',title:'收货人',width:70},
		        {field:'orderId',title:'订单ID',width:80,
		        	formatter:function(value,row,index){
		        		return "<a href='#' onclick='payRecordView("+row.id+")'>"+(value==null?"":value)+"</a>";
			        }
		        },
		        {field:'agent_fee',title:'代购费',width:50},
		        {field:'amount',title:'订单金额',width:80},
		        {field:'account',title:'支付金额',width:80},
		        {field:'payTime',title:'支付时间',width:140},
		    ]]
		})
	})
</script>
<script type="text/javascript" src="/js/easyui/easyui_grid_common.js"></script>

</head>
<body  class="easyui-layout">
<div id="imgShow"  style="position: absolute;display:none;border: 4px #ccc solid ;z-index:10;background-color:#fff;padding:5px;">
<img src="" width="160px">
</div>
<div region="north" border="false" title="搜索" collapsed="false"
		style="height: 92px; overflow:hidden;" align="left">
	<div class="tableForm datagrid-toolbar" >
	<form id="searchForm">
		<table style="height: 100%;width:auto;">
			<tr>
				<td>支付订单号</td>
				<td><input type="text" name="LIKE_o.order_no" style="width:148px;"></td>
				<td align="right">支付状态</td>
				<td>
					<select id="status" class="easyui-combobox" name="EQ_pr.status" style="width:150px;">   
					    <option value="">请选择</option>
					    <option value="SUCCESS">支付成功</option>   
					    <option value="FAIL">支付失败</option>  
					</select>  
				</td>
				<td align="right">支付时间</td>
				<td>
				<input name="GE_pr.pay_time"class="easyui-datebox" >-<input name="LE_pr.pay_time"class="easyui-datebox" > 
				</td>
			</tr>
			<tr>
				<td>社区服务站</td>
				<td><input id="community_id" type="text" name="LIKE_o.community_name"></td>
				<#if session.current_admin?? && session.current_admin.role_ids?? && session.current_admin.role_ids=='6'>
				<#else>
				<td>商铺名称</td>
				<td><input id="shop_id" name="IN_o.shop_id"/></td>
				</#if>
				<td>
					<a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-search" onclick="_search();">查询</a>
					<a href="javascript:void(0);" class="easyui-linkbutton" onclick="cleanSearch();">取消</a>
				</td>
			</tr>
		</table>
	</form>
	</div>
</div>
<div region="center" border="false">
	<table  id="form_datagrid" >   
	</table>
</div>
<div id="Dialog_"></div>
<div id="order_toolbar">
<script type="text/javascript">

//查看
function payRecordView(id_,title){
	payRecordOoip(model_name+"/view/"+id_,title);
}
function payRecordOoip(url,title){
	$.messager.progress({text:'数据加载中....',interval:100});
	$('#Dialog_').dialog({
	    title: '查看-'+model_title,   
	    width: 820,   
	    height: 500,
	    top:0, 
	    cache: false,
	    maximizable:true,
	    href: url,   
	    modal: true,
	    onLoad:function(){
	    	$.messager.progress('close');
	    },
	    onLoadError:function(){
	    	$.messager.progress('close');
	    },
		buttons:[{
			text:"关闭",
			handler:function() {
				$('#Dialog_').dialog('close');
			}
		}]
	});
}
</script>

<div id="grid_toolbar">
<a href="javascript:void(0)" id="grid_toolbar_view" onclick="view();" class="easyui-linkbutton" data-options="iconCls:'icon-redo',plain:true">查看</a>
<a href="javascript:void(0)"  onclick="datagrid.datagrid('reload');" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true">刷新</a>
<a href="javascript:void(0)"  onclick="datagrid.datagrid('clearSelections');" class="easyui-linkbutton" data-options="iconCls:'icon-undo',plain:true">取消选中</a>
</div>
</body>
</@layout>